home *** CD-ROM | disk | FTP | other *** search
- @echo off
- ! trashdir.bat Batch file to move a folder to the system Trash
- !
- ! trashdir name
- !
- ! where 'name' is the folder to be trashed. The name can be preceded by
- ! a path and a volume ID.
- !
- ! trashdir.bat calls extractName, uniqueName, copydir, and deldir
- !
- ! Copyright © 1994 by Rainbow Hill Pty Ltd. All rights reserved.
- !
-
- set trashdir_trash=1:\Trash
-
- ! ensure that the first parameter is there and that the second one is not
- set doserr=13
- if not "%2 " == " " goto ERR_LBL
- if "%1 " == " " goto ERR_LBL
-
- ! ensure that the requested folder is there
- set doserr=27
- if not existdir "%1" goto ERR_LBL
-
- ! make a name to be used in the trash
- set doserr=0
- onerror ERR_LBL
- call extractName "%1" trashdir_name
- if not %doserr% == 0 goto ERR_LBL
- call uniqueName "%trashdir_trash%\%trashdir_name%" trashdir_newName
- if not %doserr% == 0 goto ERR_LBL
-
- ! if necessary, rename the copy already in the trash
- if "%trashdir_name%" == "%trashdir_newName%" goto DO_COPY_LBL
- rendir "%trashdir_trash%\%trashdir_name%" "%trashdir_newName%"
- :DO_COPY_LBL
-
- ! copy the folder to the trash and remove the original
- call copydir "%1" "%trashdir_trash%"
- if not %doserr% == 0 goto ERR_LBL
- call deldir "%1"
- if %doserr% == 0 goto DONE_LBL
-
- :ERR_LBL
- show %doserr%
-
- :DONE_LBL
- ! remove the global variables
- set trashdir_name=
- set trashdir_newName=
- set trashdir_trash=
-